package com.slipper.ai.flow.vo;

import com.slipper.core.gson.GsonExclude;
import com.slipper.util.Tool;

import java.util.*;

public class ResultVO {
    private long time;
    private String content;
    private String message;
    private List<NodeInstVO> nodeList = new ArrayList<>();
    private List<LineVO> lineList = new ArrayList<>();
    private Map<String, Object> input = new LinkedHashMap<>();
    private Map<String, Object> output = new LinkedHashMap<>();
    @GsonExclude
    private Map<String, NodeInstVO> nodeMap = new HashMap<>();

    public long getTime() {
        return time;
    }

    public void setTime(long time) {
        this.time = time;
    }

    public String getContent() {
        return content;
    }

    public void setContent(String content) {
        this.content = content;
    }

    public String getMessage() {
        return message;
    }

    public void setMessage(String message) {
        this.message = message;
    }

    public List<NodeInstVO> getNodeList() {
        return nodeList;
    }

    public void setNodeList(List<NodeInstVO> nodeList) {
        this.nodeList = nodeList;
    }

    public List<LineVO> getLineList() {
        return lineList;
    }

    public void setLineList(List<LineVO> lineList) {
        this.lineList = lineList;
    }

    public Map<String, Object> getInput() {
        return input;
    }

    public void setInput(Map<String, Object> input) {
        this.input = input;
    }

    public Map<String, Object> getOutput() {
        return output;
    }

    public void setOutput(Map<String, Object> output) {
        this.output = output;
    }

    public Map<String, NodeInstVO> getNodeMap() {
        return nodeMap;
    }

    public void setNodeMap(Map<String, NodeInstVO> nodeMap) {
        this.nodeMap = nodeMap;
    }

    public void addContent(String content) {
        if (Tool.isBlank(content)) return;

        if (Tool.isBlank(this.content)) {
            this.content = content;
        } else {
            this.content = this.content + "\n\n" + content;
        }
    }

    public void addMessage(String message) {
        if (Tool.isBlank(message)) return;

        if (Tool.isBlank(this.message)) {
            this.message = message;
        } else {
            this.message = this.message + "\n\n" + message;
        }
    }
}
